/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejb;

import entities.Observacion;
import java.util.List;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author curso
 */
@Stateless
@LocalBean
public class ServicioObservacion {

 
   
  @PersistenceContext(unitName="BSCPU")
    private EntityManager em;
    
    public void altaObservacion(Observacion p){
        em.persist(p);    
    }
    public Observacion buscaPorId(int id){
        return em.find(Observacion.class, id);
    }
    public List<Observacion> verObservaciones(){
        return em.createNamedQuery("Observacion.findAll").getResultList();
    }
    public void borraObservacion(int id){
        Observacion a=em.find(Observacion.class, id);
        em.remove(a);    
    }
}
